$(function () {
    //chrome.notifications.create(id, options, creationCallback);

    if (window.webkitNotifications) {
        console.log("Notifications are supported!");
    }
    else {
        console.log("Notifications are not supported for this Browser/OS version yet.");
    }

    $('.notify').click(function () {
        notify();
    });
});

function notify() {
    var havePermission = window.webkitNotifications.checkPermission();
    if (havePermission == 0) {
        // 0 is PERMISSION_ALLOWED
        var notification = window.webkitNotifications.createNotification(
            'http://i.stack.imgur.com/dmHl0.png',
            'Chrome notification!',
            'Here is the notification text'
        );

        notification.onclick = function () {
            window.open("http://stackoverflow.com/a/13328397/1269037");
            notification.close();
        }
        notification.show();
    } else {
        window.webkitNotifications.requestPermission();
    }
}/**
 * Created with JetBrains PhpStorm.
 * User: Nelson
 * Date: 19/10/13
 * Time: 11:27
 * To change this template use File | Settings | File Templates.
 */
